<template>
  <a-card :bordered="false" >
    <a-spin :spinning="confirmLoading">
      <a-descriptions :title="formInfo.title">
        <a-descriptions-item label="发布人">{{ formInfo.createBy }}</a-descriptions-item>
        <a-descriptions-item label="发布时间">{{ formInfo.createTime }}</a-descriptions-item>
        <a-descriptions-item label="类型">
          {{ this.$sysDictFilter(formInfo.msgCategory, 'msgCategory') }}
        </a-descriptions-item>
        <a-descriptions-item label="优先级" span="3">
          {{ this.$sysDictFilter(formInfo.priority, 'priority') }}
        </a-descriptions-item>
        <a-descriptions-item label="内容">
          <div v-html="formInfo.content"></div>
        </a-descriptions-item>
      </a-descriptions>
      <a-row v-if="formInfo.annexUrl">
        <a-col>
          <a-divider orientation="left">
            附件内容
          </a-divider>
        </a-col>
        <a-col>
          <div class="anty-img-wrap" style="float: left">
            <w-file-show :datas="formInfo.annexUrl" :direction="1"></w-file-show>
          </div>
        </a-col>
      </a-row>
    </a-spin>
    <footer-tool-bar>
      <a-button
        @click="$router.go(-1)"
        :style="{ marginRight: '8px' }"
        icon="rollback">返回
      </a-button>
    </footer-tool-bar>
  </a-card>
</template>

<script>
import { getAction } from '@/api/manage'
import WFileShow from '@/components/WxFileUpload/WFileShow'
import FooterToolBar from '@/components/FooterToolbar'

export default {
  name: 'NoticeView',
  components: { WFileShow, FooterToolBar },
  data () {
    return {
      visible: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      formInfo: {},
      url: {
        saveInfo: '/system/sysNotice/save',
        getInfo: '/system/sysNotice/info'
      }
    }
  },
  created () {
  },
  mounted () {
    this.show()
  },
  methods: {
    show (record) {
      if (this.$route.query.id) {
        getAction(this.url.getInfo, { id: this.$route.query.id }).then(res => {
          this.$nextTick(() => {
            this.formInfo = (res.result.data)
          })
        })
      }
      this.visible = true
    },
    // 确定
    handleSubmit () {
      this.visible = false
    },
    // 关闭
    handleCancel () {
      this.close()
    },
    close () {
      this.visible = false
    }
  }
}
</script>
